package hris.mbeans;

import hris.model.User;
import hris.service.IUserService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;


@Component("mUser")
@Scope( value = "request" )
public class MUser {
	
	@Autowired
	private IUserService userService;
	
	
	public IUserService getUserService() {
		return userService;
	}
	
	
	public void setUserService(IUserService userService) {
		this.userService = userService;
	}

	private long id;
	private String name;
	private String password;

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String surname) {
		this.password = surname;
	}

	public String addUser(){
		User user = new User();
		user.setName( name );
		user.setPassword( password );
		userService.addUser( user );
		return "success";
	}
}
